package at.tugraz.hidipic.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import at.tugraz.hidipic.model.User;

/**
 *
 * @author mario
 */
public class CustomUserDetailsService implements UserDetailsService {

    @Autowired
    private HibernateTemplate hibernateTemplate;

    public void initialize() {
    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return hibernateTemplate.get(User.class, username);
    }
}
